package com.lhy.framework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Title:
 * @Description: 功能概述: 系统文件加载
 * @Author: lihaiyang
 * @version: 1.0 .
 * @Date: 2022-09-09 09:39
 * @Copyright: Copyright(c)2022 RedaFlight.comAll Rights Reserved
 */
public class FileSystemResource implements Resource {

    private final File file;

    private final String path;

    public FileSystemResource(String path) {
        this.file = new File(path);
        this.path = path;
    }

    public FileSystemResource(File file) {
        this.file = file;
        this.path = file.getPath();
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(this.file);
    }
}
